<?php

namespace App\Http\Model;
/**
 * @desc 返回提示信息
 * Class Hint
 * @package app\api\service
 */
class Hint
{
    // 通用提示
    const ERROR = -1;
    const SUCCESS = 0;
    const PARAM_ERROR = 1;
    const AUTH_ERROR = 2;
    const NOT_ALLOWED = 3;
    const LOGIN_OUT = 4;
    const TOKEN_ERROR = 5;
    const SIGN_ERROR = 6;
    const NOT_ALLOW_SEND_CODE = 7;
    const WAIT_OPEN = 8;
    const CODE_GIFT_IMG = 10;

    
    // 业务 房间
    const ROOM_NO_EXIST = 1001;
    const ROOM_USER_IS_EXIST = 1002;
    const ROOM_USER_NOT_EXIST = 1003;
    const ROOM_MICRO_NOT_EXIST = 1004;
    const ROOM_MICRO_IS_FULL = 1005;
    const ROOM_MICRO_NOT_NULL = 1006;
    const ROOM_MICRO_IS_NULL = 1007;
    const ROOM_MICRO_USER_IS_EXIST = 1008;
    const ROOM_MICRO_USER_NOT_EXIST = 1009;
    const ROOM_WAITBIT_IS_EXIST = 1010;
    const ROOM_WAITBIT_NOT_EXIST = 1011;
    const ROOM_MICRO_IS_LOCK = 1012;
    const ROOM_USER_SHOT_OFF = 1013;
    const ROOM_IS_CERTIFY = 1014;
    const ROOM_RADIO_NOT_SET = 1015;
    const ROOM_NOT_OPEN = 1016;
    const ROOM_IS_OPEN = 1017;
    const ROOM_ROLE_ROOM_MAX = 1018;
    const ROOM_PASSWORD_NEED = 1019;
    const ROOM_PASSWORD_ERR = 1020;
    const ROOM_TYPE_NOT_ALLOWED = 1021;
    const ROOM_TYPE_NOT_EXIST = 1022;



    // 业务 用户
    const USER_IS_EXIST = 2002;
    const USER_INFO_NO_EXIST = 2102;
    const SMS_CODE_ERROR = 2003;
    const PASSWORD_FORMAT_ERROR = 2004;
    const PASSWORD_ERROR = 2005;
    const USER_IS_NOT_EXIST = 2006;
    const NICKNAME_EXIST = 2009;
    const PHONE_IS_EXIST = 2010;
    const PASSWORD_NOT_ACCORD = 2011;
    const PHONE_NOT_NOW_USER = 2012;
    const PHONE_STATUS_1 = 2013;
    const PHONE_STATUS_2 = 2014;
    const PHONE_STATUS_3 = 2015;
    const PHONE_STATUS_4 = 2016;
    const THIRD_CHECK_ERROR = 2017;
    const PHONE_FORMAT_ERR = 2018;
    const USER_NOT_OWNER = 2019;
    const USER_FORBID = 2020;
    const USER_VERIFY_BEYOND = 2021;
    const USER_VERIFY_NOT_FIND = 2022;
    const USER_VERIFY_FAILED = 2023;
    const USER_VERIFY_PASS_LIVING_NOT_THE_SAME    =2024;
    const USER_VERIFY_NO_ID_CARD_NUMBER	          =2025;
    const USER_VERIFY_ID_NUMBER_NAME_NOT_MATCH	  =2026;
    const USER_VERIFY_NO_FACE_FOUND               =2027;
    const USER_VERIFY_NO_ID_PHOTO                 =2028;
    const USER_VERIFY_PHOTO_FORMAT_ERROR          =2029;
    const USER_VERIFY_DATA_SOURCE_ERROR           =2030;
    const USER_VERIFY_FAIL_LIVING_FACE_ATTACK	  =2031;
    const USER_VERIFY_VIDEO_LACK_FRAMES           =2032;
    const USER_VERIFY_FAIL_EYES_CLOSE_DETECTION   =2033;
    const USER_VERIFY_BIZ_TOKEN_DENIED	          =2034;
    const USER_VERIFY_AUTHENTICATION_FAIL         =2035;
    const USER_VERIFY_MOBILE_PHONE_NOT_SUPPORT    =2036;
    const USER_VERIFY_SDK_TOO_OLD                 =2037;
    const USER_VERIFY_MOBILE_PHONE_NO_AUTHORITY	  =2038;
    const USER_VERIFY_USER_CANCELLATION	          =2039;
    const USER_VERIFY_USER_TIMEOUT                =2040;
    const USER_VERIFY_VERIFICATION_FAILURE        =2041;
    const USER_VERIFY_UNDETECTED_FACE             =2042;
    const USER_VERIFY_ACTION_ERROR                =2043;
    const USER_VERIFY_EXIST                       =2044;
    const USER_VERIFY_NOT_ACTION                  =2045;

    const USER_UID_NOT_LIANG                 =2046;
    const USER_UID_IS_EXIST                  =2047;


    // 业务 系统
    const SYSTEM_NOVER = 3001; //版本不存在
    
    //资金
    const DIAMOND_NOT_ENOUGH = 4001;
    const CHARM_NOT_ENOUGH = 4002;
    const FINANCE_ORDER_COMPLETE = 4003;
    const FINANCE_MP_RMB_NOT_ENOUGH = 4004;

    const KK_NOT_ENOUGH = 4005;
    

    const FINANCE_WITHDRAW_TIME_CLOSE = 4005;
    const FINANCE_WITHDRAW_COUNT_CLOSE = 4006;

    const FINANCE_WITHDRAW_ORDER_NOT_EXIST = 4007;
    const FINANCE_WITHDRAW_ORDER_OPTION_FAIL = 4008;

    //商城
    const NOW_GOODS_DISABLED = 5001;

    //动态
    const TRENDS_NOT_FOUND = 6001;


    //CP
    const CP_SELF_EXIST = 7001;
    const CP_EACH_EXIST = 7002;
    const CP_NO_REQUEST = 7003;
    const CP_NOT_EXIST  = 7004;
    const CP_REQUEST_BEYOND = 7005;

    //好友关系
    const FRIENDS_NO_FRIENDS = 8001;

    // 银行卡
    const BANK_EXIST=80001;
    const BANK_NO_EXIST=80002;
    const BANK_CREATE_FAIL=80003;
    const BANK_UPDATE_FAIL=80004;
    const BANK_GET_FAIL=80005;
    const BANK_REMOVE_FAIL=80006;
    const BANK_MAX_COUNT=80007;
    const BANK_EXIST_ORDER=80008;

    // 砸蛋
    const THROWING_HAMMER_NOT_ENOUGH = 90001;
    const THROWING_PRIZE = 90002;

    //活动
    const  SEND_BUBBLE_ERROR =  40001;
    const  SEND_HEADWEAR_ERROR =  40002;
    const  INVITE_USERID_ERROR =  40003;
    const  AWARD_DIAMOND_ERROR =  40004;
    const  INVITE_USER_ERROR =  40005;
    const  INVITE_SEND_GOODS_ERROR =  40006;
    const  USER_INFO_ERROR =  40007;
    const  USER_NOT_INVITE =  40008;

    
    
    /**
     *
     * 特定通用逻辑错误码  100001-100012
     * */
    const ERR_NORMAL = 100001;
    const ERR_SYS_FAIL = 100002;
    const ERR_DB_FAIL = 100003;
    const ERR_USER_LOGIN_STATUS = 100005;
    const ERR_PARAMS_CHECK_FAIL = 100006;
    const ERR_DATA_EXIST = 100007;
    const ERR_DATA_NOT_EXIST = 100008;
    const ERR_DATA_CREATE_FAIL = 100009;
    const ERR_DATA_UPDATE_FAIL = 100010;
    const ERR_DATA_REMOVE_FAIL = 100011;
    const ERR_FAIL = 100012;
    // END

    
    static $Msg = [
        self::ERROR => '失败',
        self::SUCCESS => '成功',
        self::PARAM_ERROR => '参数错误',
        self::AUTH_ERROR => '无权限操作',
        self::NOT_ALLOWED => '不允许操作',
        self::LOGIN_OUT => '登陆态已过期',
        self::TOKEN_ERROR => 'token错误',
        self::SIGN_ERROR => '签名错误',
        self::NOT_ALLOW_SEND_CODE => '获取验证码太频繁，60秒后再试',
        self::WAIT_OPEN => '(^-^) 即将开放，敬请期待！',
        self::CODE_GIFT_IMG => '图形验证码',

        
        //业务 房间
        self::ROOM_NO_EXIST => '房间不存在',
        self::ROOM_USER_IS_EXIST => '用户已在房间内',
        self::ROOM_USER_NOT_EXIST => '用户不在房间内',
        self::ROOM_MICRO_NOT_EXIST => "麦不存在",
        self::ROOM_MICRO_IS_FULL => "麦已满",
        self::ROOM_MICRO_NOT_NULL => "麦上已有用户",
        self::ROOM_MICRO_IS_NULL => "麦上无用户",
        self::ROOM_MICRO_USER_IS_EXIST => "用户已在麦上",
        self::ROOM_MICRO_USER_NOT_EXIST => "用户未在麦上",
        self::ROOM_WAITBIT_IS_EXIST => "用户已在排麦中",
        self::ROOM_WAITBIT_NOT_EXIST => "用户不在排麦中",
        self::ROOM_MICRO_IS_LOCK => "麦锁定",
        self::ROOM_USER_SHOT_OFF => "踢出房间暂时不可进入",
        self::ROOM_IS_CERTIFY => "已认证房间不允许设置房间类型",
        self::ROOM_RADIO_NOT_SET => "电台房不允许设置房间类型",
        self::ROOM_NOT_OPEN => "房间未开启",
        self::ROOM_IS_OPEN => "房间已经开启",
        self::ROOM_ROLE_ROOM_MAX => "用户不能添加到管理员",
        self::ROOM_PASSWORD_NEED => "房间需要密码",
        self::ROOM_PASSWORD_ERR => "房间密码错误",
        self::ROOM_TYPE_NOT_ALLOWED => "非认证用户只允许选择 听歌、闲聊、CP",
        self::ROOM_TYPE_NOT_EXIST => "分类不存在",

        // 业务 用户
        self::USER_IS_EXIST => '用户已存在',
        self::USER_INFO_NO_EXIST => '用户不存在',
        self::SMS_CODE_ERROR => '验证码错误',
        self::PASSWORD_FORMAT_ERROR => '密码格式错误',
        self::PASSWORD_ERROR => '密码错误',
        self::USER_IS_NOT_EXIST => '手机号不存在',
        self::NICKNAME_EXIST => '昵称已存在',
        self::PHONE_IS_EXIST => '手机号被绑定',
        self::PASSWORD_NOT_ACCORD => '密码长度必须由6-16位数字字母组成，不能包含特殊字符',
        self::PHONE_NOT_NOW_USER => '手机号非当前登陆账户',
        self::PHONE_STATUS_1 => '未注册',
        self::PHONE_STATUS_2 => '已注册&当前登陆账户',
        self::PHONE_STATUS_3 => '已注册&非当前登陆账户',
        self::PHONE_STATUS_4 => '已注册&未登陆',
        self::THIRD_CHECK_ERROR => '信息匹配错误',
        self::PHONE_FORMAT_ERR => '手机号格式错误',
        self::USER_NOT_OWNER => '非房主不允许设置房间类型',
        self::USER_FORBID => '帐号被封号',
        self::USER_VERIFY_BEYOND => '超出验证次数',
        self::USER_VERIFY_NOT_FIND => '验证token未找到',
        self::USER_VERIFY_FAILED => '验证失败',
        self::USER_VERIFY_PASS_LIVING_NOT_THE_SAME   => '通过了活体检测，但是经过验证，待比对照片与权威数据照片，或参考照片中的至少一张，不是同一个人',
        self::USER_VERIFY_NO_ID_CARD_NUMBER	         => '权威数据错误，可能原因：权威数据无此身份证号、权威数据照片格式错误、权威数据照片中找不到人脸等可能',
        self::USER_VERIFY_ID_NUMBER_NAME_NOT_MATCH	 => '身份证号和姓名不匹配',
        self::USER_VERIFY_NO_FACE_FOUND              => '权威数据错误，可能原因：权威数据无此身份证号、权威数据照片格式错误、权威数据照片中找不到人脸等可能',
        self::USER_VERIFY_NO_ID_PHOTO                => '权威数据错误，可能原因：权威数据无此身份证号、权威数据照片格式错误、权威数据照片中找不到人脸等可能',
        self::USER_VERIFY_PHOTO_FORMAT_ERROR         => '权威数据错误，可能原因：权威数据无此身份证号、权威数据照片格式错误、权威数据照片中找不到人脸等可能',
        self::USER_VERIFY_DATA_SOURCE_ERROR          => '权威数据出现错误',
        self::USER_VERIFY_FAIL_LIVING_FACE_ATTACK	 => '未经过活体判断，可能的原因：是假脸攻击',
        self::USER_VERIFY_VIDEO_LACK_FRAMES          => '获取到的活体数据故障，请换一台手机重试',
        self::USER_VERIFY_FAIL_EYES_CLOSE_DETECTION  => '未通过闭眼检测，活体失败	',
        self::USER_VERIFY_BIZ_TOKEN_DENIED	         => '传入的 biz_token 不符合要求',
        self::USER_VERIFY_AUTHENTICATION_FAIL        => '鉴权失败',
        self::USER_VERIFY_MOBILE_PHONE_NOT_SUPPORT   => '手机在不支持列表里',
        self::USER_VERIFY_SDK_TOO_OLD                => 'SDK版本过旧，已经不被支持',
        self::USER_VERIFY_MOBILE_PHONE_NO_AUTHORITY	 => '没有权限（运动传感器、存储、相机）',
        self::USER_VERIFY_USER_CANCELLATION	         => '用户活体失败，原因可能如下：用户取消了、验证过程超时等原因；',
        self::USER_VERIFY_USER_TIMEOUT               => '用户活体失败，原因可能如下：用户取消了、验证过程超时等原因；',
        self::USER_VERIFY_VERIFICATION_FAILURE       => '用户活体失败，原因可能如下：用户取消了、验证过程超时等原因；',
        self::USER_VERIFY_UNDETECTED_FACE            => '用户活体失败，原因可能如下：用户取消了、验证过程超时等原因；',
        self::USER_VERIFY_ACTION_ERROR               => '用户活体失败，原因可能如下：用户取消了、验证过程超时等原因；',
        self::USER_VERIFY_EXIST => '已经通过认证',
        self::USER_VERIFY_NOT_ACTION => '未验证',

        self::USER_UID_NOT_LIANG => '非靓号',
        self::USER_UID_IS_EXIST => '号码已存在',

        //资金
        self::DIAMOND_NOT_ENOUGH => '钻石不足支付',
        self::CHARM_NOT_ENOUGH => '魅力不足',
        self::FINANCE_ORDER_COMPLETE => "订单已经完成",
        self::FINANCE_MP_RMB_NOT_ENOUGH => "微信公众号余额不足",
        self::KK_NOT_ENOUGH => '壳壳币不足',
        self::FINANCE_WITHDRAW_TIME_CLOSE => "提现超时不在规定时间内",
        self::FINANCE_WITHDRAW_COUNT_CLOSE => '提现次数超过限制',

        self::FINANCE_WITHDRAW_ORDER_NOT_EXIST => '订单不存在',
        self::FINANCE_WITHDRAW_ORDER_OPTION_FAIL => '订单操作失败',

        
        // 业务 系统
        self::SYSTEM_NOVER => '版本不存在',
        
        //商城
        self::NOW_GOODS_DISABLED => '当前装扮不可用',

        //动态
        self::TRENDS_NOT_FOUND => '动态不存在',

        //CP
        self::CP_SELF_EXIST => '自己已有CP',
        self::CP_EACH_EXIST => '对方已有CP',
        self::CP_NO_REQUEST => 'CP请求不存在',
        self::CP_NOT_EXIST => 'CP不存在',
        self::CP_REQUEST_BEYOND => '请求超出次数',

        //好友关系
        self::FRIENDS_NO_FRIENDS => '非好友关系',


        //银行卡
        self::BANK_EXIST=>'银行卡已存在',
        self::BANK_NO_EXIST=>'银行卡不存在',
        self::BANK_CREATE_FAIL=>'银行卡创建失败',
        self::BANK_UPDATE_FAIL=>'银行卡更新失败',
        self::BANK_GET_FAIL=>'银行卡获取失败',
        self::BANK_REMOVE_FAIL=>'银行卡删除失败',
        self::BANK_MAX_COUNT=>'银行卡已达上限',
        self::BANK_EXIST_ORDER=>'该银行卡有未结算订单',

        // 砸蛋
        self::THROWING_HAMMER_NOT_ENOUGH => '锤子不足',

        //推荐活动
        self::SEND_BUBBLE_ERROR => '赠送气泡失败',
        self::SEND_HEADWEAR_ERROR => '赠送头饰失败',
        self::INVITE_USERID_ERROR => '邀请用户信息错误',
        self::AWARD_DIAMOND_ERROR => '邀请用户奖励钻石失败',
        self::INVITE_USER_ERROR => '用户关系绑定失败',
        self::INVITE_SEND_GOODS_ERROR => '您的活动商品已经领取',
        self::USER_INFO_ERROR => '您不符合领取规定',
        self::USER_NOT_INVITE => '您还未邀请用户注册',



            /**
         * 特定通用逻辑错误码描述  100001-10012
         *
         * START
         * */
        self::ERR_NORMAL => '请求错误',
        self::ERR_SYS_FAIL => '系统异常',
        self::ERR_DB_FAIL => 'DB异常',
        self::ERR_USER_LOGIN_STATUS => '您还未登录,请登录重试',
        self::ERR_PARAMS_CHECK_FAIL => '参数缺失请检查后重试',
        self::ERR_DATA_EXIST => '数据已存在',
        self::ERR_DATA_NOT_EXIST => '数据不存在',
        self::ERR_DATA_CREATE_FAIL => '数据创建失败',
        self::ERR_DATA_UPDATE_FAIL => '数据更新失败',
        self::ERR_DATA_REMOVE_FAIL => '数据删除失败',
        self::ERR_FAIL => '失败',
        // END


    ];
    
       /**
     * @param code
     * @param msg
     * @param join 默认false 参数拼接 true：codeMsg + msg
     * @param orderBy 默认false 参数顺序拼接倒换  true：msg + codeMsg
     * */
    static function getErrCodeMsg($code, $msg = '', $join = false, $orderBy = false)
    {
        if ($orderBy and $join and !empty($msg)) {
            return $msg . self::$Msg[$code];
        }
        if ($join and !empty($msg)) {
            return self::$Msg[$code] . '：' . $msg;
        }
        if (!empty($msg)) {
            return $msg;
        }
        return self::$Msg[$code];
    }
    
}

